package com.deram.ctin.rest.web.controller.web;

import com.deram.ctin.common.bean.Page;
import com.deram.ctin.common.bean.PageResult;
import com.deram.ctin.dependencies.rest.base.BaseController;
import com.deram.ctin.serv.business.api.*;
import com.deram.ctin.serv.business.entity.*;
import com.deram.ctin.serv.business.filter.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zhangcm
 * @version 1.0, 2017/9/28
 */
@Api(tags = {"web - 企业知识产权接口"})
@RestController
@RequestMapping("/web/enter")
public class WebEnterRightInfoController extends BaseController {

    @Autowired
    private BusinessBrandApi businessBrandApi;

    @Autowired
    private BusinessPatentApi businessPatentApi;

    @Autowired
    private BusinessCopyrightApi businessCopyrightApi;

    @Autowired
    private BusinessSoftwareApi businessSoftwareApi;

    @Autowired
    private BusinessDomainApi businessDomainApi;

    @Autowired
    private BusinessQualificationApi businessQualificationApi;

    @ApiOperation(value = "商标分页")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "ID", required = true, paramType = "path"),
    })
    @GetMapping("/searchBrand/{id}")
    public PageResult<BusinessBrand> searchBrand(@PathVariable Long id, Page page){
        BusinessBrandFilter enterInfoFilter = new BusinessBrandFilter();
        enterInfoFilter.setEnterId(id);
        return businessBrandApi.search(enterInfoFilter,page.getPageNo(),page.getPageSize());
    }

    @ApiOperation(value = "专利信息分页")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "ID", required = true, paramType = "path"),
    })
    @GetMapping("/searchPatent/{id}")
    public PageResult<BusinessPatent> searchPatent(@PathVariable Long id, Page page){
        BusinessPatentFilter enterInfoFilter = new BusinessPatentFilter();
        enterInfoFilter.setEnterId(id);
        return businessPatentApi.search(enterInfoFilter,page.getPageNo(),page.getPageSize());
    }

    @ApiOperation(value = "著作权分页")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "ID", required = true, paramType = "path"),
    })
    @GetMapping("/searchCopyrightFilter/{id}")
    public PageResult<BusinessCopyright> searchCopyrightFilter(@PathVariable Long id, Page page){
        BusinessCopyrightFilter enterInfoFilter = new BusinessCopyrightFilter();
        enterInfoFilter.setEnterId(id);
        return businessCopyrightApi.search(enterInfoFilter,page.getPageNo(),page.getPageSize());
    }

    @ApiOperation(value = "软件著作权分页")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "ID", required = true, paramType = "path"),
    })
    @GetMapping("/searchSoftware/{id}")
    public PageResult<BusinessSoftware> searchSoftware(@PathVariable Long id, Page page){
        BusinessSoftwareFilter enterInfoFilter = new BusinessSoftwareFilter();
        enterInfoFilter.setEnterId(id);
        return businessSoftwareApi.search(enterInfoFilter,page.getPageNo(),page.getPageSize());
    }

    @ApiOperation(value = "域名分页")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "ID", required = true, paramType = "path"),
    })
    @GetMapping("/searchDomain/{id}")
    public PageResult<BusinessDomain> searchDomain(@PathVariable Long id, Page page){
        BusinessDomainFilter enterInfoFilter = new BusinessDomainFilter();
        enterInfoFilter.setEnterId(id);
        return businessDomainApi.search(enterInfoFilter,page.getPageNo(),page.getPageSize());
    }

    @ApiOperation(value = "资质认证分页")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "ID", required = true, paramType = "path"),
    })
    @GetMapping("/searchQualification/{id}")
    public PageResult<BusinessQualification> searchQualification(@PathVariable Long id, Page page){
        BusinessQualificationFilter enterInfoFilter = new BusinessQualificationFilter();
        enterInfoFilter.setEnterId(id);
        return businessQualificationApi.search(enterInfoFilter,page.getPageNo(),page.getPageSize());
    }
}
